# Maintainer: Martell Malone <Martell Malone at g mail dot com>

_realname=ninja
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.10.2
pkgrel=1
pkgdesc="Ninja is a small build system with a focus on speed (mingw-w64)"
arch=('any')
url="https://ninja-build.org"
license=('Apache')
depends=()
options=('strip' 'staticlibs')
makedepends=("re2c" "${MINGW_PACKAGE_PREFIX}-python")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/ninja-build/ninja/archive/v${pkgver}.tar.gz")
sha256sums=('ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed')

build() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/bin
  cd ${srcdir}/ninja-${pkgver}
  ${MINGW_PREFIX}/bin/python3 configure.py --bootstrap --platform mingw
}

package() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/bin
  mv "${srcdir}/ninja-${pkgver}/ninja.exe" "${pkgdir}${MINGW_PREFIX}"/bin/
  mkdir -p "${pkgdir}${MINGW_PREFIX}"/lib
  mv "${srcdir}/ninja-${pkgver}/build/libninja.a" "${pkgdir}${MINGW_PREFIX}"/lib/
}
